home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1997-04-03 | 4.8 KB | [TEXT/CWIE] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
Confidence | Program | Detection | Match Type | Support
|
---|
10%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| MacBinary II, Wed Apr 2 19:30:58 1997, modified Wed Apr 2 19:30:58 1997, creator 'CWIE', type ASCII, 3898 bytes "ooftst20.cpp" , at 0xfba 726 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
74%
| TrID
| Macintosh plain text (MacBinary)
| default
| |
25%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| siegfried
| fmt/1762 MacBinary (II)
| default
| |
100%
| lsar
| MacBinary
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [CWIE] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0c 6f 6f 66 74 73 74 | 32 30 2e 63 70 70 00 00 |..ooftst|20.cpp..|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 43 57 49 | 45 00 00 00 00 00 00 00 |.TEXTCWI|E.......|
|00000050| 00 00 00 00 00 0f 3a 00 | 00 02 d6 af 68 aa c2 af |......:.|....h...|
|00000060| 68 aa c2 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |h.......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 df 0e 00 00 |........|........|
|00000080| 2f 2f 20 43 6f 70 79 72 | 69 67 68 74 20 31 39 39 |// Copyr|ight 199|
|00000090| 34 20 41 2e 44 2e 20 53 | 6f 66 74 77 61 72 65 2e |4 A.D. S|oftware.|
|000000a0| 20 41 6c 6c 20 52 69 67 | 68 74 73 20 52 65 73 65 | All Rig|hts Rese|
|000000b0| 72 76 65 64 0d 0d 2f 2f | 20 4f 4f 46 54 45 53 54 |rved..//| OOFTEST|
|000000c0| 32 30 0d 0d 2f 2f 20 54 | 68 69 73 20 73 61 6d 70 |20..// T|his samp|
|000000d0| 6c 65 20 64 65 6d 6f 6e | 73 74 72 61 74 65 73 20 |le demon|strates |
|000000e0| 68 6f 77 20 74 6f 20 63 | 72 65 61 74 65 20 61 6e |how to c|reate an|
|000000f0| 20 61 64 2d 68 6f 63 20 | 71 75 65 72 79 2e 0d 0d | ad-hoc |query...|
|00000100| 2f 2f 20 53 69 6d 70 6c | 65 20 73 74 72 65 61 6d |// Simpl|e stream|
|00000110| 20 49 2f 4f 20 69 73 20 | 75 73 65 64 20 74 6f 20 | I/O is |used to |
|00000120| 69 6e 74 65 72 61 63 74 | 20 77 69 74 68 20 74 68 |interact| with th|
|00000130| 65 20 75 73 65 72 2e 0d | 0d 23 69 6e 63 6c 75 64 |e user..|.#includ|
|00000140| 65 20 22 6f 6f 66 69 6c | 65 2e 68 22 0d 23 69 6e |e "oofil|e.h".#in|
|00000150| 63 6c 75 64 65 20 22 6f | 6f 66 74 73 74 30 31 2e |clude "o|oftst01.|
|00000160| 68 22 0d 0d 76 6f 69 64 | 20 61 6e 79 4e 61 6d 65 |h"..void| anyName|
|00000170| 28 63 6f 6e 73 74 20 63 | 68 61 72 2a 20 73 65 61 |(const c|har* sea|
|00000180| 72 63 68 53 74 72 69 6e | 67 73 5b 5d 2c 20 62 6f |rchStrin|gs[], bo|
|00000190| 6f 6c 20 69 73 4f 72 2c | 20 75 6e 73 69 67 6e 65 |ol isOr,| unsigne|
|000001a0| 64 20 73 68 6f 72 74 20 | 6e 75 6d 53 63 68 29 3b |d short |numSch);|
|000001b0| 0d 76 6f 69 64 20 6c 61 | 73 74 4e 61 6d 65 28 63 |.void la|stName(c|
|000001c0| 6f 6e 73 74 20 63 68 61 | 72 2a 20 73 65 61 72 63 |onst cha|r* searc|
|000001d0| 68 53 74 72 69 6e 67 73 | 5b 5d 2c 20 75 6e 73 69 |hStrings|[], unsi|
|000001e0| 67 6e 65 64 20 73 68 6f | 72 74 20 6e 75 6d 53 63 |gned sho|rt numSc|
|000001f0| 68 29 3b 0d 0d 23 64 65 | 66 69 6e 65 20 6e 75 6d |h);..#de|fine num|
|00000200| 45 6e 74 72 69 65 73 28 | 41 29 20 73 69 7a 65 6f |Entries(|A) sizeo|
|00000210| 66 28 41 29 2f 73 69 7a | 65 6f 66 28 41 5b 30 5d |f(A)/siz|eof(A[0]|
|00000220| 29 0d 0d 09 54 45 53 54 | 5f 43 4f 4e 4e 45 43 54 |)...TEST|_CONNECT|
|00000230| 20 20 20 20 74 68 65 44 | 42 3b 0d 09 64 62 50 65 | theD|B;..dbPe|
|00000240| 6f 70 6c 65 20 20 20 20 | 20 50 65 6f 70 6c 65 3b |ople | People;|
|00000250| 0d 0d 0d 69 6e 74 20 6d | 61 69 6e 28 29 0d 7b 0d |...int m|ain().{.|
|00000260| 09 63 6f 75 74 20 3c 3c | 20 22 4f 4f 46 49 4c 45 |.cout <<| "OOFILE|
|00000270| 20 56 61 6c 69 64 61 74 | 69 6f 6e 20 53 75 69 74 | Validat|ion Suit|
|00000280| 65 20 2d 20 54 65 73 74 | 20 32 30 5c 6e 22 0d 09 |e - Test| 20\n"..|
|00000290| 09 20 3c 3c 20 22 44 65 | 6d 6f 6e 73 74 72 61 74 |. << "De|monstrat|
|000002a0| 69 6f 6e 20 6f 66 20 61 | 64 2d 68 6f 63 20 71 75 |ion of a|d-hoc qu|
|000002b0| 65 72 79 20 62 75 69 6c | 64 69 6e 67 5c 6e 22 3b |ery buil|ding\n";|
|000002c0| 0d 09 0d 2f 2f 20 62 69 | 74 20 6f 66 20 63 6f 6d |...// bi|t of com|
|000002d0| 70 6c 69 63 61 74 65 64 | 20 66 69 6c 65 6e 61 6d |plicated| filenam|
|000002e0| 65 20 6c 6f 67 69 63 20 | 74 6f 20 73 75 70 70 6f |e logic |to suppo|
|000002f0| 72 74 20 64 69 66 66 65 | 72 65 6e 74 20 62 61 63 |rt diffe|rent bac|
|00000300| 6b 65 6e 64 73 0d 2f 2f | 20 77 69 74 68 20 74 68 |kends.//| with th|
|00000310| 69 73 20 6f 6e 65 20 74 | 65 73 74 20 70 72 6f 67 |is one t|est prog|
|00000320| 72 61 6d 0d 0d 23 69 66 | 64 65 66 20 54 45 53 54 |ram..#if|def TEST|
|00000330| 49 4e 47 5f 43 54 52 45 | 45 0d 2f 2f 20 77 65 20 |ING_CTRE|E.// we |
|00000340| 63 61 6e 20 75 73 65 20 | 73 65 70 61 72 61 74 65 |can use |separate|
|00000350| 20 66 69 6c 65 73 2c 20 | 6f 72 20 61 20 73 69 6e | files, |or a sin|
|00000360| 67 6c 65 20 63 6f 6e 74 | 61 69 6e 65 72 20 66 69 |gle cont|ainer fi|
|00000370| 6c 65 0d 2f 2f 20 61 6e | 64 20 74 68 69 73 20 73 |le.// an|d this s|
|00000380| 61 6d 70 6c 65 20 75 73 | 65 73 20 73 65 70 61 72 |ample us|es separ|
|00000390| 61 74 65 20 66 69 6c 65 | 73 0d 09 74 68 65 44 42 |ate file|s..theDB|
|000003a0| 2e 75 73 65 53 65 70 61 | 72 61 74 65 46 69 6c 65 |.useSepa|rateFile|
|000003b0| 73 28 29 3b 0d 0d 09 23 | 69 66 64 65 66 20 5f 4d |s();...#|ifdef _M|
|000003c0| 61 63 69 6e 74 6f 73 68 | 0d 2f 2f 20 70 61 74 68 |acintosh|.// path|
|000003d0| 20 68 61 6e 64 6c 69 6e | 67 20 6f 6e 6c 79 20 6f | handlin|g only o|
|000003e0| 6e 20 74 68 65 20 4d 61 | 63 20 61 74 20 70 72 65 |n the Ma|c at pre|
|000003f0| 73 65 6e 74 0d 09 09 63 | 6f 6e 73 74 20 63 68 61 |sent...c|onst cha|
|00000400| 72 2a 20 6b 45 78 69 73 | 74 73 4e 61 6d 65 20 3d |r* kExis|tsName =|
|00000410| 20 20 22 3a 6f 6f 66 74 | 73 74 30 31 3a 50 65 6f | ":ooft|st01:Peo|
|00000420| 70 6c 65 2e 64 61 74 22 | 3b 0d 09 09 63 6f 6e 73 |ple.dat"|;...cons|
|00000430| 74 20 63 68 61 72 2a 20 | 6b 44 61 74 61 62 61 73 |t char* |kDatabas|
|00000440| 65 4e 61 6d 65 20 3d 20 | 22 3a 6f 6f 66 74 73 74 |eName = |":ooftst|
|00000450| 30 31 3a 22 3b 0d 09 23 | 65 6c 73 65 0d 09 09 63 |01:";..#|else...c|
|00000460| 6f 6e 73 74 20 63 68 61 | 72 2a 20 6b 45 78 69 73 |onst cha|r* kExis|
|00000470| 74 73 4e 61 6d 65 20 3d | 20 20 20 22 50 65 6f 70 |tsName =| "Peop|
|00000480| 6c 65 2e 64 61 74 22 0d | 09 09 63 6f 6e 73 74 20 |le.dat".|..const |
|00000490| 63 68 61 72 2a 20 6b 44 | 61 74 61 62 61 73 65 4e |char* kD|atabaseN|
|000004a0| 61 6d 65 20 3d 20 22 22 | 3b 0d 09 23 65 6e 64 69 |ame = ""|;..#endi|
|000004b0| 66 09 0d 0d 23 65 6c 73 | 65 0d 09 23 69 66 64 65 |f...#els|e..#ifde|
|000004c0| 66 20 54 45 53 54 49 4e | 47 5f 44 42 41 53 45 0d |f TESTIN|G_DBASE.|
|000004d0| 09 09 23 69 66 64 65 66 | 20 5f 4d 61 63 69 6e 74 |..#ifdef| _Macint|
|000004e0| 6f 73 68 0d 09 09 09 63 | 6f 6e 73 74 20 63 68 61 |osh....c|onst cha|
|000004f0| 72 2a 20 6b 45 78 69 73 | 74 73 4e 61 6d 65 20 3d |r* kExis|tsName =|
|00000500| 20 20 22 3a 6f 6f 66 74 | 73 74 30 31 3a 50 65 6f | ":ooft|st01:Peo|
|00000510| 70 6c 65 2e 64 62 66 22 | 3b 0d 09 09 09 63 6f 6e |ple.dbf"|;....con|
|00000520| 73 74 20 63 68 61 72 2a | 20 6b 44 61 74 61 62 61 |st char*| kDataba|
|00000530| 73 65 4e 61 6d 65 20 3d | 20 22 3a 6f 6f 66 74 73 |seName =| ":oofts|
|00000540| 74 30 31 3a 22 3b 0d 09 | 09 23 65 6c 73 65 0d 09 |t01:";..|.#else..|
|00000550| 09 09 63 6f 6e 73 74 20 | 63 68 61 72 2a 20 6b 45 |..const |char* kE|
|00000560| 78 69 73 74 73 4e 61 6d | 65 20 3d 20 20 20 22 50 |xistsNam|e = "P|
|00000570| 65 6f 70 6c 65 2e 64 62 | 66 22 0d 09 09 09 63 6f |eople.db|f"....co|
|00000580| 6e 73 74 20 63 68 61 72 | 2a 20 6b 44 61 74 61 62 |nst char|* kDatab|
|00000590| 61 73 65 4e 61 6d 65 20 | 3d 20 22 22 3b 0d 09 09 |aseName |= "";...|
|000005a0| 23 65 6e 64 69 66 09 0d | 0d 09 23 65 6c 73 65 0d |#endif..|..#else.|
|000005b0| 09 09 2f 2f 20 50 65 72 | 73 69 73 74 65 6e 74 20 |..// Per|sistent |
|000005c0| 52 41 4d 2c 20 6e 6f 20 | 6f 70 74 69 6f 6e 20 6f |RAM, no |option o|
|000005d0| 66 20 73 69 6e 67 6c 65 | 20 66 69 6c 65 0d 09 09 |f single| file...|
|000005e0| 23 69 66 64 65 66 20 5f | 4d 61 63 69 6e 74 6f 73 |#ifdef _|Macintos|
|000005f0| 68 0d 09 09 09 63 6f 6e | 73 74 20 63 68 61 72 2a |h....con|st char*|
|00000600| 20 6b 44 61 74 61 62 61 | 73 65 4e 61 6d 65 20 3d | kDataba|seName =|
|00000610| 20 22 3a 6f 6f 66 74 73 | 74 30 31 3a 6f 6f 66 74 | ":oofts|t01:ooft|
|00000620| 73 74 30 31 2e 64 62 22 | 3b 0d 09 09 23 65 6c 73 |st01.db"|;...#els|
|00000630| 65 0d 09 09 09 63 6f 6e | 73 74 20 63 68 61 72 2a |e....con|st char*|
|00000640| 20 6b 44 61 74 61 62 61 | 73 65 4e 61 6d 65 20 3d | kDataba|seName =|
|00000650| 20 22 6f 6f 66 74 73 74 | 30 31 2e 64 62 22 3b 0d | "ooftst|01.db";.|
|00000660| 09 09 23 65 6e 64 69 66 | 09 0d 09 09 63 6f 6e 73 |..#endif|....cons|
|00000670| 74 20 63 68 61 72 2a 20 | 6b 45 78 69 73 74 73 4e |t char* |kExistsN|
|00000680| 61 6d 65 20 3d 20 6b 44 | 61 74 61 62 61 73 65 4e |ame = kD|atabaseN|
|00000690| 61 6d 65 3b 0d 09 23 65 | 6e 64 69 66 0d 23 65 6e |ame;..#e|ndif.#en|
|000006a0| 64 69 66 0d 0d 2f 2f 20 | 6f 70 65 6e 20 6f 72 20 |dif..// |open or |
|000006b0| 63 72 65 61 74 65 20 74 | 68 65 20 64 61 74 61 62 |create t|he datab|
|000006c0| 61 73 65 09 0d 09 69 66 | 20 28 64 62 43 6f 6e 6e |ase...if| (dbConn|
|000006d0| 65 63 74 3a 3a 66 69 6c | 65 45 78 69 73 74 73 28 |ect::fil|eExists(|
|000006e0| 6b 45 78 69 73 74 73 4e | 61 6d 65 29 29 20 7b 0d |kExistsN|ame)) {.|
|000006f0| 09 09 74 68 65 44 42 2e | 6f 70 65 6e 43 6f 6e 6e |..theDB.|openConn|
|00000700| 65 63 74 69 6f 6e 28 6b | 44 61 74 61 62 61 73 65 |ection(k|Database|
|00000710| 4e 61 6d 65 29 3b 0d 09 | 09 63 6f 75 74 20 3c 3c |Name);..|.cout <<|
|00000720| 20 22 4a 75 73 74 20 6f | 70 65 6e 65 64 2e 2e 2e | "Just o|pened...|
|00000730| 5c 6e 22 20 3c 3c 20 74 | 68 65 44 42 20 3c 3c 20 |\n" << t|heDB << |
|00000740| 65 6e 64 6c 20 3c 3c 20 | 65 6e 64 6c 3b 0d 09 7d |endl << |endl;..}|
|00000750| 0d 09 65 6c 73 65 20 7b | 0d 09 09 74 68 65 44 42 |..else {|...theDB|
|00000760| 2e 6e 65 77 43 6f 6e 6e | 65 63 74 69 6f 6e 28 6b |.newConn|ection(k|
|00000770| 44 61 74 61 62 61 73 65 | 4e 61 6d 65 29 3b 0d 09 |Database|Name);..|
|00000780| 09 50 65 6f 70 6c 65 2e | 41 64 64 54 65 73 74 44 |.People.|AddTestD|
|00000790| 61 74 61 28 29 3b 0d 09 | 7d 0d 0d 09 50 65 6f 70 |ata();..|}...Peop|
|000007a0| 6c 65 2e 73 65 6c 65 63 | 74 41 6c 6c 28 29 3b 0d |le.selec|tAll();.|
|000007b0| 09 63 6f 75 74 20 3c 3c | 20 22 4c 69 73 74 69 6e |.cout <<| "Listin|
|000007c0| 67 20 72 65 63 6f 72 64 | 73 5c 6e 22 20 3c 3c 20 |g record|s\n" << |
|000007d0| 28 64 62 56 69 65 77 28 | 50 65 6f 70 6c 65 29 20 |(dbView(|People) |
|000007e0| 3c 3c 20 50 65 6f 70 6c | 65 2e 4c 61 73 74 4e 61 |<< Peopl|e.LastNa|
|000007f0| 6d 65 20 3c 3c 20 50 65 | 6f 70 6c 65 2e 4f 74 68 |me << Pe|ople.Oth|
|00000800| 65 72 4e 61 6d 65 73 29 | 3b 0d 0d 09 63 6f 6e 73 |erNames)|;...cons|
|00000810| 74 20 63 68 61 72 2a 20 | 75 73 65 72 45 6e 74 72 |t char* |userEntr|
|00000820| 69 65 73 5b 5d 20 3d 20 | 7b 22 44 65 6e 74 22 2c |ies[] = |{"Dent",|
|00000830| 20 22 41 6e 64 79 22 7d | 3b 09 0d 09 61 6e 79 4e | "Andy"}|;...anyN|
|00000840| 61 6d 65 28 75 73 65 72 | 45 6e 74 72 69 65 73 2c |ame(user|Entries,|
|00000850| 20 74 72 75 65 2c 20 6e | 75 6d 45 6e 74 72 69 65 | true, n|umEntrie|
|00000860| 73 28 75 73 65 72 45 6e | 74 72 69 65 73 29 29 3b |s(userEn|tries));|
|00000870| 0d 09 61 6e 79 4e 61 6d | 65 28 75 73 65 72 45 6e |..anyNam|e(userEn|
|00000880| 74 72 69 65 73 2c 20 66 | 61 6c 73 65 2c 20 6e 75 |tries, f|alse, nu|
|00000890| 6d 45 6e 74 72 69 65 73 | 28 75 73 65 72 45 6e 74 |mEntries|(userEnt|
|000008a0| 72 69 65 73 29 29 3b 0d | 0d 09 63 6f 6e 73 74 20 |ries));.|..const |
|000008b0| 63 68 61 72 2a 20 75 73 | 65 72 45 6e 74 72 69 65 |char* us|erEntrie|
|000008c0| 73 32 5b 5d 20 3d 20 7b | 22 44 65 6e 74 22 2c 20 |s2[] = {|"Dent", |
|000008d0| 22 54 61 79 2a 22 7d 3b | 09 0d 09 6c 61 73 74 4e |"Tay*"};|...lastN|
|000008e0| 61 6d 65 28 75 73 65 72 | 45 6e 74 72 69 65 73 32 |ame(user|Entries2|
|000008f0| 2c 20 6e 75 6d 45 6e 74 | 72 69 65 73 28 75 73 65 |, numEnt|ries(use|
|00000900| 72 45 6e 74 72 69 65 73 | 29 29 3b 0d 09 63 6f 75 |rEntries|));..cou|
|00000910| 74 20 3c 3c 20 22 54 65 | 73 74 20 43 6f 6d 70 6c |t << "Te|st Compl|
|00000920| 65 74 65 64 22 20 3c 3c | 20 65 6e 64 6c 3b 0d 09 |eted" <<| endl;..|
|00000930| 0d 09 72 65 74 75 72 6e | 20 45 58 49 54 5f 53 55 |..return| EXIT_SU|
|00000940| 43 43 45 53 53 3b 0d 7d | 20 0d 0d 0d 76 6f 69 64 |CCESS;.}| ...void|
|00000950| 0d 61 6e 79 4e 61 6d 65 | 28 63 6f 6e 73 74 20 63 |.anyName|(const c|
|00000960| 68 61 72 2a 20 73 65 61 | 72 63 68 53 74 72 69 6e |har* sea|rchStrin|
|00000970| 67 73 5b 5d 2c 20 62 6f | 6f 6c 20 69 73 4f 72 2c |gs[], bo|ol isOr,|
|00000980| 20 75 6e 73 69 67 6e 65 | 64 20 73 68 6f 72 74 20 | unsigne|d short |
|00000990| 6e 75 6d 53 63 68 29 0d | 7b 0d 09 64 62 51 75 65 |numSch).|{..dbQue|
|000009a0| 72 79 20 74 68 65 51 75 | 65 72 79 3b 0d 09 69 66 |ry theQu|ery;..if|
|000009b0| 20 28 69 73 4f 72 29 0d | 09 09 63 6f 75 74 20 3c | (isOr).|..cout <|
|000009c0| 3c 20 22 4f 52 22 3b 0d | 09 65 6c 73 65 0d 09 09 |< "OR";.|.else...|
|000009d0| 63 6f 75 74 20 3c 3c 20 | 22 41 4e 44 22 3b 0d 09 |cout << |"AND";..|
|000009e0| 63 6f 75 74 20 3c 3c 20 | 22 20 51 75 65 72 79 69 |cout << |" Queryi|
|000009f0| 6e 67 20 65 69 74 68 65 | 72 20 4c 61 73 74 20 6f |ng eithe|r Last o|
|00000a00| 72 20 4f 74 68 65 72 6e | 61 6d 65 73 20 3d 20 5c |r Othern|ames = \|
|00000a10| 6e 22 3b 0d 09 0d 09 66 | 6f 72 20 28 75 6e 73 69 |n";....f|or (unsi|
|00000a20| 67 6e 65 64 20 73 68 6f | 72 74 20 69 3d 30 3b 20 |gned sho|rt i=0; |
|00000a30| 69 3c 6e 75 6d 53 63 68 | 3b 20 69 2b 2b 29 20 7b |i<numSch|; i++) {|
|00000a40| 0d 09 09 63 6f 75 74 20 | 3c 3c 20 22 20 20 20 22 |...cout |<< " "|
|00000a50| 20 3c 3c 20 73 65 61 72 | 63 68 53 74 72 69 6e 67 | << sear|chString|
|00000a60| 73 5b 69 5d 20 3c 3c 20 | 65 6e 64 6c 3b 0d 0d 2f |s[i] << |endl;../|
|00000a70| 2f 20 63 6f 6e 73 74 72 | 75 63 74 20 63 6c 61 75 |/ constr|uct clau|
|00000a80| 73 65 73 20 6f 6e 20 74 | 68 65 20 68 65 61 70 20 |ses on t|he heap |
|00000a90| 6f 74 68 65 72 77 69 73 | 65 20 74 68 65 79 20 61 |otherwis|e they a|
|00000aa0| 72 65 20 74 65 6d 70 6f | 72 61 72 69 65 73 0d 2f |re tempo|raries./|
|00000ab0| 2f 20 77 68 69 63 68 20 | 77 6f 6e 27 74 20 65 78 |/ which |won't ex|
|00000ac0| 69 73 74 20 62 79 20 74 | 68 65 20 74 69 6d 65 20 |ist by t|he time |
|00000ad0| 77 65 20 64 6f 20 74 68 | 65 20 73 65 61 72 63 68 |we do th|e search|
|00000ae0| 28 29 0d 09 09 0d 09 09 | 64 62 51 75 65 72 79 43 |()......|dbQueryC|
|00000af0| 6c 61 75 73 65 2a 20 74 | 65 72 6d 31 20 3d 20 6e |lause* t|erm1 = n|
|00000b00| 65 77 20 64 62 51 75 65 | 72 79 42 69 6e 61 72 79 |ew dbQue|ryBinary|
|00000b10| 28 0d 09 09 09 50 65 6f | 70 6c 65 2e 4c 61 73 74 |(....Peo|ple.Last|
|00000b20| 4e 61 6d 65 20 3d 3d 20 | 73 65 61 72 63 68 53 74 |Name == |searchSt|
|00000b30| 72 69 6e 67 73 5b 69 5d | 0d 09 09 29 3b 0d 09 09 |rings[i]|...);...|
|00000b40| 64 62 51 75 65 72 79 43 | 6c 61 75 73 65 2a 20 74 |dbQueryC|lause* t|
|00000b50| 65 72 6d 32 20 3d 20 6e | 65 77 20 64 62 51 75 65 |erm2 = n|ew dbQue|
|00000b60| 72 79 42 69 6e 61 72 79 | 28 0d 09 09 09 50 65 6f |ryBinary|(....Peo|
|00000b70| 70 6c 65 2e 4f 74 68 65 | 72 4e 61 6d 65 73 20 3d |ple.Othe|rNames =|
|00000b80| 3d 20 73 65 61 72 63 68 | 53 74 72 69 6e 67 73 5b |= search|Strings[|
|00000b90| 69 5d 0d 09 09 29 3b 0d | 0d 2f 2f 20 74 68 65 20 |i]...);.|.// the |
|00000ba0| 66 6f 6c 6c 6f 77 69 6e | 67 20 69 73 20 61 20 62 |followin|g is a b|
|00000bb0| 69 74 20 73 75 62 74 6c | 65 20 2d 20 74 68 65 20 |it subtl|e - the |
|00000bc0| 6f 70 65 72 61 74 6f 72 | 7c 7c 0d 2f 2f 20 77 68 |operator|||.// wh|
|00000bd0| 69 63 68 20 74 61 6b 65 | 73 20 70 6f 69 6e 74 65 |ich take|s pointe|
|00000be0| 72 73 20 63 72 65 61 74 | 65 73 20 61 20 64 62 51 |rs creat|es a dbQ|
|00000bf0| 75 65 72 79 42 69 6e 61 | 72 79 43 6f 6d 62 6f 4f |ueryBina|ryComboO|
|00000c00| 77 6e 65 72 0d 2f 2f 20 | 77 68 69 63 68 20 77 69 |wner.// |which wi|
|00000c10| 6c 6c 20 64 65 6c 65 74 | 65 20 74 68 65 20 73 75 |ll delet|e the su|
|00000c20| 62 2d 63 6c 61 75 73 65 | 73 0d 09 09 69 66 20 28 |b-clause|s...if (|
|00000c30| 69 73 4f 72 29 20 7b 0d | 2f 2f 09 09 09 74 68 65 |isOr) {.|//...the|
|00000c40| 51 75 65 72 79 20 7c 3d | 20 28 2a 74 65 72 6d 31 |Query |=| (*term1|
|00000c50| 20 7c 7c 20 74 65 72 6d | 32 29 3b 20 65 71 75 69 | || term|2); equi|
|00000c60| 76 61 6c 65 6e 74 20 74 | 6f 20 74 68 65 20 66 6f |valent t|o the fo|
|00000c70| 6c 6c 6f 77 69 6e 67 0d | 09 09 09 74 68 65 51 75 |llowing.|...theQu|
|00000c80| 65 72 79 20 7c 3d 20 74 | 65 72 6d 31 3b 0d 09 09 |ery |= t|erm1;...|
|00000c90| 09 74 68 65 51 75 65 72 | 79 20 7c 3d 20 74 65 72 |.theQuer|y |= ter|
|00000ca0| 6d 32 3b 0d 09 09 7d 0d | 09 09 65 6c 73 65 0d 09 |m2;...}.|..else..|
|00000cb0| 09 09 74 68 65 51 75 65 | 72 79 20 26 3d 20 28 2a |..theQue|ry &= (*|
|00000cc0| 74 65 72 6d 31 20 7c 7c | 20 74 65 72 6d 32 29 3b |term1 ||| term2);|
|00000cd0| 0d 09 7d 0d 09 50 65 6f | 70 6c 65 2e 73 65 61 72 |..}..Peo|ple.sear|
|00000ce0| 63 68 28 74 68 65 51 75 | 65 72 79 29 3b 0d 0d 09 |ch(theQu|ery);...|
|00000cf0| 63 6f 75 74 20 3c 3c 20 | 22 5c 6e 4c 69 73 74 69 |cout << |"\nListi|
|00000d00| 6e 67 20 72 65 73 75 6c | 74 20 6f 66 20 71 75 65 |ng resul|t of que|
|00000d10| 72 79 5c 6e 22 20 0d 09 | 09 20 3c 3c 20 28 64 62 |ry\n" ..|. << (db|
|00000d20| 56 69 65 77 28 50 65 6f | 70 6c 65 29 20 3c 3c 20 |View(Peo|ple) << |
|00000d30| 50 65 6f 70 6c 65 2e 4c | 61 73 74 4e 61 6d 65 20 |People.L|astName |
|00000d40| 3c 3c 20 50 65 6f 70 6c | 65 2e 4f 74 68 65 72 4e |<< Peopl|e.OtherN|
|00000d50| 61 6d 65 73 29 20 3c 3c | 20 65 6e 64 6c 3b 0d 0d |ames) <<| endl;..|
|00000d60| 7d 0d 0d 0d 0d 76 6f 69 | 64 0d 6c 61 73 74 4e 61 |}....voi|d.lastNa|
|00000d70| 6d 65 28 63 6f 6e 73 74 | 20 63 68 61 72 2a 20 73 |me(const| char* s|
|00000d80| 65 61 72 63 68 53 74 72 | 69 6e 67 73 5b 5d 2c 20 |earchStr|ings[], |
|00000d90| 75 6e 73 69 67 6e 65 64 | 20 73 68 6f 72 74 20 6e |unsigned| short n|
|00000da0| 75 6d 53 63 68 29 0d 7b | 0d 09 64 62 51 75 65 72 |umSch).{|..dbQuer|
|00000db0| 79 20 74 68 65 51 75 65 | 72 79 3b 0d 09 63 6f 75 |y theQue|ry;..cou|
|00000dc0| 74 20 3c 3c 20 22 51 75 | 65 72 79 69 6e 67 20 4c |t << "Qu|erying L|
|00000dd0| 61 73 74 6e 61 6d 65 20 | 3d 20 61 6e 79 20 6f 66 |astname |= any of|
|00000de0| 5c 6e 22 3b 0d 09 0d 09 | 66 6f 72 20 28 75 6e 73 |\n";....|for (uns|
|00000df0| 69 67 6e 65 64 20 73 68 | 6f 72 74 20 69 3d 30 3b |igned sh|ort i=0;|
|00000e00| 20 69 3c 6e 75 6d 53 63 | 68 3b 20 69 2b 2b 29 20 | i<numSc|h; i++) |
|00000e10| 7b 0d 09 09 63 6f 75 74 | 20 3c 3c 20 22 20 20 20 |{...cout| << " |
|00000e20| 22 20 3c 3c 20 73 65 61 | 72 63 68 53 74 72 69 6e |" << sea|rchStrin|
|00000e30| 67 73 5b 69 5d 20 3c 3c | 20 65 6e 64 6c 3b 0d 0d |gs[i] <<| endl;..|
|00000e40| 2f 2f 20 63 6f 6e 73 74 | 72 75 63 74 20 63 6c 61 |// const|ruct cla|
|00000e50| 75 73 65 73 20 6f 6e 20 | 74 68 65 20 68 65 61 70 |uses on |the heap|
|00000e60| 20 6f 74 68 65 72 77 69 | 73 65 20 74 68 65 79 20 | otherwi|se they |
|00000e70| 61 72 65 20 74 65 6d 70 | 6f 72 61 72 69 65 73 0d |are temp|oraries.|
|00000e80| 2f 2f 20 77 68 69 63 68 | 20 77 6f 6e 27 74 20 65 |// which| won't e|
|00000e90| 78 69 73 74 20 62 79 20 | 74 68 65 20 74 69 6d 65 |xist by |the time|
|00000ea0| 20 77 65 20 64 6f 20 74 | 68 65 20 73 65 61 72 63 | we do t|he searc|
|00000eb0| 68 28 29 0d 09 09 0d 09 | 09 64 62 51 75 65 72 79 |h().....|.dbQuery|
|00000ec0| 43 6c 61 75 73 65 2a 20 | 74 68 65 54 65 72 6d 20 |Clause* |theTerm |
|00000ed0| 3d 20 6e 65 77 20 64 62 | 51 75 65 72 79 42 69 6e |= new db|QueryBin|
|00000ee0| 61 72 79 28 0d 09 09 09 | 50 65 6f 70 6c 65 2e 4c |ary(....|People.L|
|00000ef0| 61 73 74 4e 61 6d 65 20 | 3d 3d 20 73 65 61 72 63 |astName |== searc|
|00000f00| 68 53 74 72 69 6e 67 73 | 5b 69 5d 0d 09 09 29 3b |hStrings|[i]...);|
|00000f10| 0d 0d 09 09 74 68 65 51 | 75 65 72 79 20 7c 3d 20 |....theQ|uery |= |
|00000f20| 74 68 65 54 65 72 6d 3b | 0d 09 7d 0d 09 50 65 6f |theTerm;|..}..Peo|
|00000f30| 70 6c 65 2e 73 65 61 72 | 63 68 28 74 68 65 51 75 |ple.sear|ch(theQu|
|00000f40| 65 72 79 29 3b 0d 0d 09 | 63 6f 75 74 20 3c 3c 20 |ery);...|cout << |
|00000f50| 22 5c 6e 4c 69 73 74 69 | 6e 67 20 72 65 73 75 6c |"\nListi|ng resul|
|00000f60| 74 20 6f 66 20 71 75 65 | 72 79 5c 6e 22 20 0d 09 |t of que|ry\n" ..|
|00000f70| 09 20 3c 3c 20 28 64 62 | 56 69 65 77 28 50 65 6f |. << (db|View(Peo|
|00000f80| 70 6c 65 29 20 3c 3c 20 | 50 65 6f 70 6c 65 2e 4c |ple) << |People.L|
|00000f90| 61 73 74 4e 61 6d 65 20 | 3c 3c 20 50 65 6f 70 6c |astName |<< Peopl|
|00000fa0| 65 2e 4f 74 68 65 72 4e | 61 6d 65 73 29 20 3c 3c |e.OtherN|ames) <<|
|00000fb0| 20 65 6e 64 6c 3b 0d 0d | 7d 0d 00 00 00 00 00 00 | endl;..|}.......|
|00000fc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fe0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ff0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001000| 00 00 01 00 00 00 02 48 | 00 00 01 48 00 00 00 8e |.......H|...H....|
|00001010| 65 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |e.......|........|
|00001020| 00 00 00 00 00 00 00 00 | 00 00 00 01 00 00 14 9d |........|........|
|00001030| 0c 6f 6f 66 74 73 74 32 | 30 2e 63 70 70 32 02 00 |.ooftst2|0.cpp2..|
|00001040| 00 00 50 61 72 74 53 49 | 54 21 00 00 00 00 00 00 |..PartSI|T!......|
|00001050| 00 00 50 61 72 74 53 49 | 54 21 00 00 00 00 00 00 |..PartSI|T!......|
|00001060| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001070| 00 00 b0 1b 75 fd 00 00 | 00 00 00 00 02 d6 00 00 |....u...|........|
|00001080| 00 00 00 01 00 00 14 be | ac 34 04 63 08 4a 50 45 |........|.4.c.JPE|
|00001090| 47 56 69 65 77 72 6f 61 | 76 69 67 61 74 6f 72 aa |GViewroa|vigator.|
|000010a0| 20 32 2e 30 20 45 72 72 | 6f 72 73 29 00 00 00 03 | 2.0 Err|ors)....|
|000010b0| 00 00 12 5a ad 59 aa 86 | 13 52 45 49 57 41 70 72 |...Z.Y..|.REIWApr|
|000010c0| 69 6e 74 20 39 35 2f 30 | 37 2f 32 34 00 00 00 00 |int 95/0|7/24....|
|000010d0| 00 00 00 00 00 00 00 00 | 00 00 00 03 00 00 09 b5 |........|........|
|000010e0| ac 44 06 19 13 52 45 49 | 57 41 70 72 69 6e 74 20 |.D...REI|WAprint |
|000010f0| 39 35 2f 30 37 2f 30 34 | 00 00 00 00 00 00 00 00 |95/07/04|........|
|00001100| 00 00 00 94 00 00 00 16 | 00 00 05 41 00 00 05 41 |........|...A...A|
|00001110| 00 01 00 00 00 01 00 50 | 00 00 ff ff 00 01 00 00 |.......P|........|
|00001120| 00 00 ff ff ff ff ff ff | 00 00 00 00 00 00 00 00 |........|........|
|00001130| 00 00 00 00 ff ff ff ff | ff ff 01 dc 01 dc 01 dc |........|........|
|00001140| ef f1 ff ff 3f 0e 00 00 | 00 00 00 00 ff ff ff ff |....?...|........|
|00001150| ff ff 00 00 00 00 00 00 | 00 00 00 00 00 00 00 2d |........|.......-|
|00001160| 00 01 01 e0 02 7b 00 00 | 00 00 00 00 00 00 00 00 |.....{..|........|
|00001170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001180| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001190| 00 00 00 00 00 00 00 00 | 00 00 00 16 01 00 00 00 |........|........|
|000011a0| 00 00 00 00 01 00 01 00 | 00 07 07 43 6f 75 72 69 |........|...Couri|
|000011b0| 65 72 00 00 00 08 00 00 | 00 00 00 00 00 00 00 00 |er......|........|
|000011c0| 00 32 00 03 00 00 01 db | 00 00 01 df 05 6d 61 69 |.2......|.....mai|
|000011d0| 6e 00 00 00 08 d4 00 00 | 08 db 07 61 6e 79 4e 61 |n.......|...anyNa|
|000011e0| 6d 65 00 00 0c ed 00 00 | 0c f5 09 6c 61 73 74 4e |me......|...lastN|
|000011f0| 61 6d 65 00 00 00 00 48 | 00 09 4d 6f 6e 61 63 6f |ame....H|..Monaco|
|00001200| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001210| 00 00 00 00 00 00 00 00 | 00 00 00 03 00 04 00 7d |........|.......}|
|00001220| 00 08 02 30 02 88 00 7d | 00 08 02 30 02 88 af 68 |...0...}|...0...h|
|00001230| 72 c2 00 00 00 00 00 00 | 00 00 00 00 00 00 01 00 |r.......|........|
|00001240| 00 00 00 04 00 01 00 01 | 00 00 01 00 00 00 02 48 |........|.......H|
|00001250| 00 00 01 48 00 00 00 8e | 01 a3 eb 60 2a f8 00 00 |...H....|...`*...|
|00001260| 00 1c 00 8e 00 04 45 50 | 4f 53 00 00 00 2a 4d 50 |......EP|OS...*MP|
|00001270| 53 52 00 01 00 36 46 50 | 52 46 00 00 00 4e 46 50 |SR...6FP|RF...NFP|
|00001280| 72 66 00 00 00 5a 4d 57 | 42 42 00 00 00 66 03 ed |rf...ZMW|BB...f..|
|00001290| ff ff 00 00 00 00 00 00 | 00 00 03 ef ff ff 00 00 |........|........|
|000012a0| 00 be 00 00 00 00 03 ed | ff ff 00 00 00 f4 00 00 |........|........|
|000012b0| 00 00 05 1a ff ff 00 00 | 00 98 00 00 00 00 05 1a |........|........|
|000012c0| ff ff 00 00 00 b2 00 00 | 00 00 03 f0 ff ff 00 00 |........|........|
|000012d0| 01 40 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.@......|........|
|000012e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000012f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+